const base_uri = 'https://case.daokeyun.com/v2/';

const postRequest = (url, param) =>{
	console.log('token', uni.getStorageSync('token'))
	return new Promise((resolve, reject)=>{
		
		uni.request({
			url:url,
			data:param,
			method:'POST',
			header:{
				'content-type':'application/json',
				'Access-Control-Allow-Origin':"*",
				'Authorization':uni.getStorageSync('token'),
				'uuid':uni.getStorageSync('uuid')
			},
			 dataType:'json',
			success:function(res) {
				resolve(res);
			},
			fail:function(res) {
				reject(res)
			}
		})
	})
}


const getRequest = (url, param) =>{
	console.log('token', uni.getStorageSync('token'))
	return new Promise((resolve, reject)=>{
		uni.request({
			url:base_uri+url,
			data:param,
			method:'GET',
			dataType:'json',
			header:{
				'content-type':'application/json',
				'Access-Control-Allow-Origin':"*",
				'Authorization':uni.getStorageSync('token'),
				'uuid':uni.getStorageSync('uuid')
			},
			success:function(res) {
				resolve(res);
			},
			fail:function(res) {
				reject(res)
			}
		})
	})
}
const api = {postRequest, getRequest};
export default api;